package com.jxgk.application.controller;


import com.jxgk.application.pojo.User;
import com.jxgk.application.service.UserService;
import com.sun.org.apache.xpath.internal.operations.Mod;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping("user")
public class Usercontroller {
    @Autowired
    private UserService userService;
    @RequestMapping("loge")
     public String loge(String uname, String pass){
        if (uname!=null&&pass!=null){
            List<User> user = userService.loge(uname,pass);
            if (user.get(0)!=null){
                return "redirect:/user/finduser";
            }
        }
        return "loge";
    }



    @RequestMapping("finduser")
    public String finduser(Model model){
        List<User> u =  userService.finduser();
        model.addAttribute("u",u);
        return "show";
    }

}

